Cocos2d-x 多分辨率适配完全解析
Overview
从Cocos2d-x 2.0.4开始,Cocos2d-x提出了自己的多分辨率支持方案,废弃了之前的retina相关设置接口,提出了design resolution概念。1
2
3
4
5
6
7Director::getInstance()->getOpenGLView()->setDesignResolutionSize() //设计分辨率大小及模式
Director::getInstance()->setContentScaleFactor() //内容缩放因子
FileUtils::getInstance()->setSearchPaths() //资源搜索路径
Director::getInstance()->getOpenGLView()->getFrameSize() //屏幕分辨率
Director::getInstance()->getWinSize() //设计分辨率
Director::getInstance()->getVisibleSize() //设计分辨率可视区域大小
Director::getInstance()->getVisibleOrigin() //设计分辨率可视区域起点
从cocos2d-2.1beta3-x-2.1.1开始,CCFileUtils::sharedFileUtils()->setResourceDirectory()
被新接口FileUtils::getInstance()->setSearchPaths(searchPath)
替代